package com.huawei.appgallery.appcomment.ui.view;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import o.azb;
import o.bcg.c;
import o.bcg.d;
import o.bcg.e;

public class AddCommentTitle extends LinearLayout implements OnClickListener {
    private ImageView ˊ;
    private LinearLayout ˋ;
    private a ˎ;
    private TextView ˏ;
    private LinearLayout ॱ;

    public interface a {
        void ˋ();

        void ॱ();
    }

    public void setOnTitleClickListener(a aVar) {
        this.ˎ = aVar;
    }

    public AddCommentTitle(Context context) {
        this(context, (AttributeSet) null);
    }

    public AddCommentTitle(Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public AddCommentTitle(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ॱ(context);
    }

    private void ॱ(Context context) {
        ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(d.ॱ, this, true);
        azb.ˏ((View) this);
        setOrientation(0);
        this.ˏ = (TextView) findViewById(e.ˋ);
        this.ॱ = (LinearLayout) findViewById(e.ˎ);
        this.ˋ = (LinearLayout) findViewById(e.ˊ);
        this.ˊ = (ImageView) findViewById(e.ˏ);
        this.ॱ.setOnClickListener(this);
        this.ˋ.setOnClickListener(this);
    }

    public void setCommentLayoutStatus(boolean z) {
        if (z) {
            this.ˊ.setImageResource(c.ॱ);
        } else {
            this.ˊ.setImageResource(c.ॱॱ);
        }
        this.ˋ.setClickable(z);
    }

    public void setCommentContent(String str) {
        this.ˏ.setText(str);
    }

    public void setImageViewStatus(String str, float f) {
        if (!TextUtils.isEmpty(str)) {
            setCommentLayoutStatus(true);
        } else if (f > 0.0f) {
            setCommentLayoutStatus(true);
        } else {
            setCommentLayoutStatus(false);
        }
    }

    public void onClick(View view) {
        if (this.ˎ != null) {
            int id = view.getId();
            if (e.ˎ == id) {
                this.ˎ.ˋ();
            } else if (e.ˊ == id) {
                this.ˎ.ॱ();
            }
        }
    }
}
